# -*- coding: utf-8 -*-
# @Time    : 2022/5/24 14:35
# @Author  : liuzehai~
# @Email   : 1129309473@qq.com
# @File    : page_after_login.py.py
from time import sleep

from selenium import webdriver
'''登陆页面'''
from selenium.webdriver.common.by import By
# 引入By类
from page.page_base import BasePage
#引入基类
class AfterLogin(BasePage):
    #元素定位器
    ele_username_locator = (By.NAME, "username")
    ele_password_locator = (By.NAME, "password")
    ele_admin_locator = (By.CSS_SELECTOR,"body > form > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(5) > td:nth-child(2) > input")
    #实例方法,已抽到基类
    #操作方法
    #管理员姓名
    def input_username(self):
        self.driver.find_element(*self.ele_username_locator).send_keys("admin")
    #管理员密码
    def input_password(self):
        self.driver.find_element(*self.ele_password_locator).send_keys("admin123")
    #登陆按钮
    def click_admin(self):
        self.driver.find_element(*self.ele_admin_locator).click()
    #汇总操作
    def login(self):
        self.input_username()
        self.input_password()
        self.click_admin()